package collections.list;

import com.google.common.collect.Lists;

import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
 * @Author: ycy
 * @CreateDate: 2020/5/6 21:01
 */
public class RemoveDemo {

  public static <T> void removeList(List<T> list, int section) {
    if (list == null || list.isEmpty()) {
      return;
    }
    if (list.size() > section) {
      int index = 0;
      Iterator<T> iterator = list.iterator();
      while (iterator.hasNext()) {
        iterator.next();
        index++;
        if (index > section) {
          iterator.remove();
        }
      }
    }
  }

  public static void main(String[] args) {
//    List<Integer> docs = Lists.newArrayList(1,2,2,12,423,4,32,5,243,5,432,6,546,5412,31,23,123,12,312,3);
//    removeList(docs,2);
//    System.out.println(docs);


    Date date = new Date(1560366030659L);
    System.out.println(date);

  }

}
